using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Content;

using QuestFramework;

namespace QuestFramework.UI
{
    public class WindowManager : Microsoft.Xna.Framework.DrawableGameComponent
    {
        private List<Window> windows;
        private PlayerInfoWindow playerInfoWindow;
        public DialogWindow dialogWindow;

        public WindowManager(Game game)
            : base(game)
        {
            windows = new List<Window>();

            playerInfoWindow = new PlayerInfoWindow(game);
            dialogWindow = new DialogWindow(game);

            playerInfoWindow.Visible = false;
            dialogWindow.Visible = false;

            windows.Add(playerInfoWindow);
            windows.Add(dialogWindow);
        }

        public override void Initialize()
        {
            for (int currentWindow = 0; currentWindow < windows.Count; currentWindow++)
            {
                windows[currentWindow].Initialize();
            }

            base.Initialize();
        }

        public override void Update(GameTime gameTime)
        {
            for (int currentWindow = 0; currentWindow < windows.Count; currentWindow++)
            {
                windows[currentWindow].Update(gameTime);
            }

            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            for (int currentWindow = 0; currentWindow < windows.Count; currentWindow++)
            {
                windows[currentWindow].Draw(gameTime);
            }
            
            base.Draw(gameTime);
        }

        public List<Window> Windows
        {
            get { return windows; }
        }
    }
}